home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
zbpc_460.zip
/
DEMOS.EXE
/
SORT.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-06-16
|
768b
|
17 lines
00010 REM ANY ARRAY TYPE MAY BE USED
00020 REM IF YOU WANT SA(500) TO BE A STRING ARRAY, USE DEFSTR S ON THIS LINE
00030 REM IF STRINGS ARE USED, SET THE LENGTH OF SA(500) WITH DEFLEN=30 OR WHATEVER
00040 DIM SA(500),L(30),R(30):REM L AND R ARE USED IN QUICK SORT ONLY
00050 NI = 500:REM CHANGE DIM 500 AND THIS 500 IF ARRAY SORT LARGER
00060 FOR X = 0 TO NI
00070 SA(X)=RND(1000):REM STORES RANDOM NUMBERS FOR SORTING
00080 REM:SA(X)=STRING$(RND(20),RND(60)+32) ONLY IF SA() IS A STRING ARRAY
00090 NEXT
00100 PRINT "START TIME: ";TIME$
00110 GOSUB "QUICK SORT" :REM OR SHELL SORT
00120 PRINT "FINISH TIME: ";TIME$
00130 FOR X=NI-10 TO NI
00140 PRINT SA(X):REM PRINT LAST 10 ELEMENTS TO MAKE SURE SORT WORKED
00150 NEXT
00160 END